<!--
 * @Author: 花香蝶自来 1026583651@qq.com
 * @Date: 2024-04-16 18:35:31
 * @LastEditors: 花香蝶自来 1026583651@qq.com
 * @LastEditTime: 2024-05-29 19:16:37
 * @FilePath: /crm/components/formz/components/formselect.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <view class="">
    <u-form-item :label="item.label" borderBottom ref="item1" :prop="item.value">
      <!-- <view @click="tap" style="flex: 1">{{ inputValue }}</view> -->
	  <view
	     @click="tap"
	  	style="flex: 1"
	    :class="[
	      inputValue!=='请选择' ? 'uni-input-input' : 'select-wrap',
	    ]"
	    >{{ inputValue }}</view>
    </u-form-item>
    <customers0 ref="customers0" @change="change"></customers0>
  </view>
</template>

<script>
import { getCompanyInfo, getPageid } from "@/apis/customer/index"
import customers0 from './customers0.vue';
export default {
  components: {
    customers0
  },
  data() {
    return {
      show: false,
      inputValue: "请选择"
    };
  },

  props: {
    item: {
      typeof: Object,
      default: () => {
        return {};
      },
    },
    data: {
      typeof: Object,
      default: () => {
        return {};
      },
    },
    customId: {
      typeof: [String, Number, Boolean, Array, Object],
      default: () => {
        return "";
      },
    },
    customContactsId: {
      typeof: [String, Number, Boolean, Array, Object],
      default: () => {
        return "";
      },
    },
  },
  computed: {
    inputid() {
      return [this.customId, this.customContactsId]
    }
  },
  watch: {
    async inputid() {
      console.log(this.customId, this.customContactsId, "data");
      if (this.customId == "" || this.customContactsId == "") {
        this.inputValue = "请选择"
        return
      }
      let data = await getCompanyInfo(this.customId)
      let data2 = await getPageid({ id: this.customContactsId })
      // name
      this.inputValue = `${data.name}${data2.name}(${this.customId})`
      console.log(data, data2, "data");
    }
  },
  methods: {
    tap() {
      this.$refs.customers0.show()
    },
    change(e) {
      this.$emit('update:customId', e.id)
      this.$emit('update:customContactsId', e.id)
    },
  },
};
</script>

<style scoped lang="scss">
  .uni-input-input {
	font-size: 14px!important;
	color: #171A1D!important;
	line-height: 99rpx!important;
	height: 99rpx!important; 
	padding-left: 10px;
  }
 .uni-forms-item__label {
   margin-left: 0;
   font-size: 14px!important;
   color: #171A1D!important;
   line-height: 99rpx!important;
   height: 99rpx!important;
 }
 .select-wrap {
   color:#C1C5C9;
   font-size:14px;
   line-height: 99rpx!important;
   height: 99rpx!important;
   padding-left: 10px;
 }
	
</style>
